﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.Script.Services;

/// <summary>
/// Summary description for DefaultWebService
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[ScriptService]
public class DefaultWebService : System.Web.Services.WebService
{
    public DefaultWebService()
    {

    }

    [WebMethod]    
    public string HelloWorld()
    {
        return "Hello World";
    }
    [WebMethod(EnableSession=true)]
    [ScriptMethod]
    public void ChanageSesseion(string sessionName,string msg)
    {
        if (null == Session[sessionName])
        {
            return;
        }
        Session[sessionName] = msg;
    }
    [WebMethod(EnableSession = true)]
    [ScriptMethod]
    public void AddValue(string key, string value)
    {
        Dictionary<string, string> list = (Dictionary<string, string>)Session["ValueDictionary"];
        list.Add(key, value);
    }
    [WebMethod(EnableSession = true)]
    [ScriptMethod]
    public string GetValue(string key)
    {
        Dictionary<string, string> list = (Dictionary<string, string>)Session["ValueDictionary"];
        return list[key];
    }
}

